<!-- eslint-disable vue/valid-template-root -->
<template>
  <PageLayout>
    <ProPageList
      :requestApi="getTableListApi"
      :columns="arr1"
      :config="config"
      :options="options"
      :filterList="filterList"
    />
  </PageLayout>
</template>

<script setup lang="ts">
  import { options, filterList, config } from './constants'
  // import { PageLayout, ProPageList, usePost,ColumnProps } from '@hdzk-hel/pangu'
  import { PageLayout, ProPageList, usePost } from '@hdzk-hel/pangu'
  import { ref, watchEffect, onMounted } from 'vue'
  // watch, ref,
  //   console.log('xx', usePost)
  const props = withDefaults(
    defineProps<{
      modelValue?: string
      disabled?: boolean
      placeholder?: string
      configList?: object
    }>(),
    {}
  )
  // const value = ref(props.modelValue)
  // export const columns: ColumnProps[] = []
  const arr1 = ref()
  // watch(
  //   () => props,
  //   () => {
  //     value.value = props.modelValue
  //     console.log(22222222222)
  //   },
  //   () => props?.configList?.componentColumns,
  //   () => {
  //     arr1.value = [props?.configList?.componentColumns]
  //     console.log(arr1.value, 111111111111)
  //   }
  // )
  watchEffect(() => {
    console.log(props?.configList?.componentColumns, '传入得数据')
    arr1.value = !props?.configList?.componentColumns
      ? []
      : [JSON.parse(props?.configList?.componentColumns)]
    console.log(arr1.value, '接口前的数据')
    // 在这里可以拿到最新的 props 值，并进行相应的处理
  })
  const { runAsync: getTableListApi } = usePost(
    'POST',
    '/aps/v1/api/planProduction/pageList'
  )
  onMounted(() => {})
</script>
